package cate.game.role.bag.prop.msg;

import cate.game.GameBody;
import cate.game.client.ClientContext;
import cate.game.client.msg.ClientMsg;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgInput;
import cate.game.client.msg.id.MsgIdBBag;
import easy.java.dev.note.NoteField;
import easy.java.practice.errorcode.EcResult;

@ClientMsg(title = "连开礼包使用请求")
public class ContinuePackUseReq implements MsgInput {
    @NoteField(value = "礼包唯一ID")
    public String itemUid;

    @NoteField(value = "自选参数", detail = "自选才传，选择的奖励index")
    public int selectedIndex;

    @Override
    public void execute(GameBody game, ClientContext cc) {
        EcResult<Void> r = cc.getRole().getBag().prop.useContinuePack(itemUid, selectedIndex);
        if(!r.ok()){
            game.notice.message(cc.getRole(), r.message);
        }
    }

    @Override
    public MsgConfig conf() {
        return MsgIdBBag.CONTINUE_PACK_USE_REQ;
    }
}
